package game.assist.diablo3.data.dao.impl;

import game.assist.diablo3.data.dao.RoleTypeDAO;
import game.assist.diablo3.data.vo.RoleType;
import game.assist.diablo3.db.DiabloDatabaseHelper;

import java.sql.SQLException;
import java.util.ArrayList;

import com.j256.ormlite.android.apptools.OrmLiteBaseActivity;
import com.j256.ormlite.dao.Dao;

public class RoleTypeDaoImpl implements RoleTypeDAO {

	private OrmLiteBaseActivity<DiabloDatabaseHelper> ormLiteBaseActivity;

	public RoleTypeDaoImpl(OrmLiteBaseActivity<DiabloDatabaseHelper> ormLiteBaseActivity) {
		super();
		this.ormLiteBaseActivity = ormLiteBaseActivity;
	}

	@Override
	public ArrayList<RoleType> queryAllRoleType() throws SQLException {
		Dao<RoleType, Integer> roleTypesDao = ormLiteBaseActivity.getHelper().getRoleTypeDao();
		ArrayList<RoleType> roleTypeList = (ArrayList<RoleType>) roleTypesDao.queryForAll();
		return roleTypeList;
	}

	public RoleType getRoleTypeById(int roleId) throws SQLException {
		Dao<RoleType, Integer> roleTypeDao = ormLiteBaseActivity.getHelper().getRoleTypeDao();
		return roleTypeDao.queryForId(roleId);
	}

}
